package com.huwei.activemq.mq;

import org.apache.rocketmq.spring.annotation.ConsumeMode;
import org.apache.rocketmq.spring.annotation.MessageModel;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

/**
 * @Author: 胡伟
 * @Date: 2021/1/14 15:00
 * @Description:
 */

/**
 * MessageModel：集群模式；广播模式(CLUSTERING)
 * ConsumeMode：顺序消费；无序消费
 */
@Component
@RocketMQMessageListener(topic = "topic_huwei", consumerGroup = "huwei",
        //selectorExpression = "tag1",selectorType = SelectorType.TAG,
        messageModel = MessageModel.CLUSTERING, consumeMode = ConsumeMode.CONCURRENTLY)
public class Consumer implements RocketMQListener<String> {

    public void onMessage(String s) {
        System.out.println("消息消费了---->" + s);
    }
}
